cmake_minimum_required(VERSION 3.16)
project(ETM_Server LANGUAGES C)
set(PROJECT_VERSION "1.0.0")
#设置c++标准
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

#设置编译选项
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -Wextra") # 使用 C 的标志变量
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")

#设置输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#查找依赖包
find_package(Threads REQUIRED)

#包含子目录
add_subdirectory(src)
add_subdirectory(apps)

#安装规则
install(TARGETS server
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib
)